<?php
	include_once("king_head.php");
?>

<?php
	include_once("ClsSebent/config.php");

	if($action=="resetlogo" && $_SESSION['SITE_ID'] != ""){
		$sql="SELECT * FROM site_home WHERE id='101'";

		$result = mysql_query($sql);
		$num=1;
		if($main_data=mysql_fetch_array($result)){
			$sql="UPDATE `site_home` SET `logo`='" . $main_data["logo"] . "' , `logo_alt`='" . $main_data["logo_alt"] . "' WHERE id=".$_SESSION['SITE_ID'];
			mysql_query($sql);
			

			$logo=$main_data["logo"];
			if($logo) copy("./logos/101_frontlogo.jpg" ,"./logos/".${site_id}."_frontlogo.jpg");

		}
	}
?>

<CENTER>
<H2> Account Settings</H2>
<form enctype="multipart/form-data"  method="post">
<input type='hidden' name='site_id' value="<?php echo $_SESSION['SITE_ID']; ?>">
<TABLE width=400 height="151">
<tr>
<td></td>
  <td height="19">
<?php 
	$qry="SELECT min(id) FROM site_page WHERE site_id=".$_SESSION['SITE_ID'];
	//echo $qry;
	$result = mysql_query($qry);
	if($page_data=mysql_fetch_row($result)){
		$pid=$page_data[0];
		echo "<a href='page.php?site_id=".$_SESSION['SITE_ID']."&pid=".$pid."' target='_blank'>Access My Home Page</a>";
	}
	else
		echo "Access My Home Page<BR>(Create your page through<BR>the link \"Manage Pages\")";
?></td></tr>
<tr>
  <td height="19"></td>
  <td height="19"><?php 
if($_SESSION['SITE_ID']!=101)
{
	$qery="Select updates from reseller where site_id=".$_SESSION['SITE_ID'];
	$res = mysql_query($qery);
	$a=mysql_fetch_array($res);
	$status=($a["updates"]=="Y")? "(Currently On)":"(Currently Off)";	
	print("<a href=\"update_options.php?sid=".$_SESSION['SITE_ID']."\">Accept Updates".$status);
}
?></a><?php if($_SESSION['SITE_ID']==101) echo"<a href=\"reseller_uploads.php?site_id=".$_SESSION['SITE_ID']."\">Reseller Uploads</a>";?></td></tr>
<tr><td height="19">
<a href="default_pct.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>">Change Default Percentage</a>
</td>
<td height="19">
<a href="resetpass.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>">Reset Password</a></td>
</tr>
<tr>
<td height="19">
<?php if($_SESSION['SITE_ID']==101)
{echo "<a href=\"Managelogos.php?site_id=".$_SESSION['SITE_ID']."\">Manage Logos</a>";}?>
<?php if($_SESSION['SITE_ID']!=101)
{echo "<a href=\"confirm.php?site_id=".$_SESSION['SITE_ID']."&action=resetsettings\">Reset Settings</a>";}?></td>
<td height="19">
<?php if($_SESSION['SITE_ID']==101)
{echo "<a href=\"reseller_rep.php?site_id=".$_SESSION['SITE_ID']."\" target=\"blank\">Resellers Report</a>";} else{echo "<a href=\"propose_prod.php?site_id=".$_SESSION['SITE_ID']."\">Propose A Product</a>";}?></td>
</tr>
<tr>
  <td height="19"><a href="manage_cat.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>">Manage Category</a></td>
  <td height="19"><?php 
  $xx="Select uploads from reseller where site_id=".$_SESSION['SITE_ID'];
  $rr=mysql_query($xx);
  $cc=mysql_fetch_row($rr);
  if($cc[0]=='Y')
{echo "<a href=\"file_upload.php?site_id=".$_SESSION['SITE_ID']."\">File Uploads</a>";}?></td>
</tr>
<tr>
<td height="19">
<?php if($_SESSION['SITE_ID']==101){?>
<a href="upload_per.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>">Upload Permissions </a><?php }?></td>
<td height="19"><?php if($_SESSION['SITE_ID']==101){?><a href="mem_alloc.php?site_id=<?php echo $_SESSION['SITE_ID'];?>">Memory Allocation</a> <?php }?></td>
</tr>
<tr>
  <td height="19"><?php if($_SESSION['SITE_ID']==101){?><a href="p_upload_per.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>">    
    Page Upload Permissions</a> <?php }?></td>
  <td height="19"><?php if($_SESSION['SITE_ID']==101){?><a href="proposed_prod.php?site_id=101">Proposed Products </a><?php }?></td>
</tr>
<tr>
  <td height="19"><?php if($_SESSION['SITE_ID']!=101){?><a href="reseller_edit.php?site_id=<?php echo $_SESSION['SITE_ID'];?>">Edit Personal Information</a><?php }?> </td>
  <td height="19"><?php if($_SESSION['SITE_ID']==101){$a_q="Select auto_pilot from reseller where site_id=101"; $a_r=mysql_query($a_q); $a_rw=mysql_fetch_array($a_r); $a_s=($a_rw['auto_pilot']=='Y')?"(Currently On)":"(Currently Off)";?><a href="auto_pilot.php?site_id=<?php echo $_SESSION['SITE_ID'];?>&ap=<?php echo $a_rw['auto_pilot'];?>">Auto Pilot <?php echo $a_s;?></a><?php }?> </td>
</tr>
</TABLE>
</form><table width="88%" height="108" border="0">
  <tr>
    <td width="140" valign="top"><?php if($_SESSION['SITE_ID']==101){?><form action="del_file.php?sid=<?php echo $_SESSION['SITE_ID'];?>" method="post" name="frmdel" id="frmdel">
      Uploaded Files:<br />
          <select name="file_nm">
            <?php
	
		$hnd=opendir("./downloads_".$_SESSION['SITE_ID']);
		while($file=readdir($hnd))		
		{			
			if($file!="." && $file!=".." && $file!="WS_FTP.LOG")
			{?>
            <option value="<?php echo $file; ?>"><?php echo $file;?></option>
            <?php }			
		}
	?>
        </select>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <input name="submit" type="submit" value="Delete File" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</form><?php }?></td>
    <td width="139" align="center" valign="middle">
      <?php include_once('downloads1.php');?>      &nbsp;</td>
  </tr>
</table>
</CENTER>
<?php
	include_once("king_foot.php");
?>